<?php
include_once '/var/www/html/new/com.inc.php';
include("/var/www/html/new/conf/yd.le.je");
$ydle=new yd_go_sql();
$ydle->connect(); 
$id=$_REQUEST['id'];
if(count($id)>0){
    if($_REQUEST['data-state']=='标记为取消发布'){
        for($i=0;$i<count($id);$i++){
            $sql="update uu_blog set status='3' where id={$id[$i]}";
            $res=$GLOBALS['ydle']->query($sql);
        }
        if($res){
               echo "<script>alert('取消成功!');parent.window.location='blog.html';</script>";
            }else{
               echo "<script>alert('取消失败!');parent.window.location='blog.html';</script>";
            }
    }else if($_REQUEST['data-state']=='标记为已发布'){
        for($i=0;$i<count($id);$i++){
            $sql="update uu_blog set status='2' where id={$id[$i]}";
            $res=$GLOBALS['ydle']->query($sql);
            
        }
        if($res){
            echo "<script>alert('发布成功!');parent.window.location='blog.html';</script>";
            }else{
            echo "<script>alert('发布失败!');parent.window.location='blog.html';</script>";
            }
    }else if($_REQUEST['data-state']=='删除'){
        for($i=0;$i<count($id);$i++){
            $sql="update uu_blog set status='4' where id={$id[$i]}";
            $res=$GLOBALS['ydle']->query($sql);
            
        }
        if($res){
            echo "<script>alert('删除成功!');parent.window.location='blog.html';</script>";
            }else{
            echo "<script>alert('删除失败!');parent.window.location='blog.html';</script>";
            }
    }
}else{
    echo "请先选择一篇游记";
}


?>